<?php

namespace Tests\Browser\Pages\Admin\Panx;

use Laravel\Dusk\Browser;
use Tests\Browser\Pages\Page;

class LoginPage extends Page
{
    /**
     * Get the URL for the page.
     *
     * @return string
     */
    public function url()
    {
        return '/web-admin/#/login';
    }

    /**
     * Assert that the browser is on the page.
     *
     * @param  Browser $browser
     * @return void
     */
    public function assert(Browser $browser)
    {
//        $browser->assertPathIs($this->url());
    }

    /**
     * Get the element shortcuts for the page.
     *
     * @return array
     */
    public function elements()
    {
        return [
            '@element'   => '#selector',

            // 前端这里 input 要加上 class，很多按钮 css 找比较麻烦
            '@account'           => 'input[type=text]',
            '@password'          => 'input[type=password]',
            '@customer-account'  => 'input[name=customer-user]',
            '@customer-password' => 'input[name=customer-password]',
            '@store-account'     => 'input[name=store-user]',
            '@store-password'    => 'input[name=store-password]',
            '@login-btn'         => 'form button',
            '@customer'          => '.ivu-tabs-nav > div:nth-last-of-type(2)',
            '@store'             => '.ivu-tabs-nav > div:nth-last-of-type(1)',
        ];
    }
}
